package com.zhaozhaonews.article.controller.v1;


import com.zhaozhaonews.article.service.ApArticleService;
import com.zhaozhaonews.common.constants.ArticleConstants;
import com.zhaozhaonews.model.article.dto.ArticleHomeDto;
import com.zhaozhaonews.model.common.dto.ResponseResult;
import org.apache.commons.net.nntp.Article;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author WanJl
 * @version 1.0
 * @title ArticleHomeController
 * @description
 * @create 2025/2/17
 */
@RestController
@RequestMapping("/api/v1/article")
public class ArticleHomeController {

    @Resource
    private ApArticleService apArticleService;

    @PostMapping("/load")
    public ResponseResult<List<Article>> load(@RequestBody ArticleHomeDto articleHomeDto) {
        return ResponseResult.okResult(apArticleService.load(ArticleConstants.LOADTYPE_LOAD_MORE, articleHomeDto));
    }
    @PostMapping("/loadmore")
    public ResponseResult<List<Article>> loadMore(@RequestBody ArticleHomeDto articleHomeDto){
        return ResponseResult.okResult(apArticleService.load(ArticleConstants.LOADTYPE_LOAD_MORE, articleHomeDto));
    }
    @PostMapping("/loadnew")
    public ResponseResult<List<Article>> loadNew(@RequestBody ArticleHomeDto articleHomeDto){
        return ResponseResult.okResult(apArticleService.load(ArticleConstants.LOADTYPE_LOAD_NEW, articleHomeDto));
    }
}
